/* eslint-disable @typescript-eslint/no-explicit-any */

import { defineComponent, KeepAlive } from 'vue'
import { RouterView, RouteRecordRaw } from 'vue-router'
import BottomNav from '@/common/BottomNav'

export default defineComponent({
  name: 'Index',
  setup() {
    return () => (
      <>
        <RouterView
          v-slots={{
            // 需要注意,由于这里是嵌套路由
            // 如果父组件被卸载, 这里的 'Component' 会是 'undefined',导致警告
            // 这里处理的方式是添加一个默认值
            default: ({ Component = () => <div></div> }: { Component: any; route: RouteRecordRaw }) => {
              return (
                <KeepAlive include={['Home', 'Mine']}>
                  <Component />
                </KeepAlive>
              )
            },
          }}
        />

        {/* <BottomNav /> */}
      </>
    )
  },
})
